package com.hzcx.app.simplechat.ui.moment;

import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.hzcx.app.simplechat.R;
import com.hzcx.app.simplechat.base.BaseActivity;
import com.hzcx.app.simplechat.event.CreateMomentEvent;
import com.hzcx.app.simplechat.view.MainBlueConfirmButton;

import org.greenrobot.eventbus.EventBus;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 发布动态-超链接
 */
public class MomentCreateHttpActivity extends BaseActivity {
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.iv_back)
    ImageView ivBack;
    @BindView(R.id.iv_title_right)
    ImageView ivTitleRight;
    @BindView(R.id.tv_title_right)
    TextView tvTitleRight;
    @BindView(R.id.tv_tips)
    TextView tvTips;
    @BindView(R.id.et_content)
    EditText etContent;
    @BindView(R.id.btn_commit)
    MainBlueConfirmButton btnCommit;

    @Override
    public int getLayout() {
        return R.layout.activity_moment_create_http;
    }

    @Override
    public void initPresenter() {

    }

    @Override
    public void initView() {
        btnCommit.setEditText(etContent, 1);

        btnCommit.setOnClickListener(view -> {
            String str = etContent.getText().toString();
            if (!str.contains("http://")) {
                str = "http://" + str;
            }
            EventBus.getDefault().post(new CreateMomentEvent(CreateMomentEvent.HTTP, str));
            finish();
        });
    }

    @Override
    public void initData() {

    }

}
